package com.freemalll.merchant.domain.dto;


import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * 接口平台：用户信息分析：接口调用参数
 *
 * @author yangjun
 * @version 1.0
 * @date 2022/12/19
 */
@Data
public class DTOInnerUseParseConfig {

    private ParseTdBean parseTd;
    private PhoneAddressBean phoneAddress;
    private MarkTxlBean markTxl;
    private MsgParseBean msgParse;
    private CallLogCallsBean callLogCalls;
    private CallsMatchTxlBean callsMatchTxl;
    private TxlStatisticsBean txlStatistics;
    private PDParsePhoneBean pDParsePhone;
    private AliParsePhoneBean aliParsePhone;
    private Id2MetaVerify id2MetaVerify;
    private BankMetaVerify bankMetaVerify;
    private List<CommonInterfaceBase> commonInterfaceBaseList;
    private AliAddressStandard aliAddressStandard;

    //header
    private String Authorization;
    //非必须  header
    private String Secret;

    @Data
    public class AliAddressStandard {
        /**
         * url : 192.168.1.47:8089/aliCloudAuth/id2MetaVerify
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : aliOrc
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

        private String querySwitch;

    }

    @Data
    public class ParseTdBean {
        /**
         * url : http://192.168.1.29:8089/innerUser/parseTd/
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : user
         */

        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

    }

    @Data
    public class PhoneAddressBean {
        /**
         * url : http://192.168.1.29:8089/innerUser/parseTd/
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : user
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

    }

    @Data
    public class MarkTxlBean {
        /**
         * url : http://192.168.1.29:8089/innerUser/parseTd/
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : user
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

    }

    @Data
    public class MsgParseBean {
        /**
         * url : http://192.168.1.29:8089/innerUser/parseTd/
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : user
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

    }

    @Data
    public class CallLogCallsBean {
        /**
         * url : http://192.168.1.29:8089/innerUser/parseTd/
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : user
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

    }

    @Data
    public class CallsMatchTxlBean {
        /**
         * url : http://192.168.1.29:8089/innerUser/parseTd/
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : user
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

    }

    @Data
    public class TxlStatisticsBean {
        /**
         * url : http://192.168.1.29:8089/innerUser/parseTd/
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : user
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;

    }

    @Data
    public class PDParsePhoneBean {
        private String url;
        private String urlOne;
        private String apiCode;
        private String apiCodeOne;
        private String appid;
        private String thirdAccCode;
        private String phoneQuerySwitch;

    }

    @Data
    public class AliParsePhoneBean{
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;
        private String phoneQuerySwitch;

    }

    @Data
    public class Id2MetaVerify {
        /**
         * url : 192.168.1.47:8089/aliCloudAuth/id2MetaVerify
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : aliOrc
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;
    }

    @Data
    public class BankMetaVerify {
        /**
         * url : 192.168.1.47:8089/aliCloudAuth/id2MetaVerify
         * apiCode : API2022121916282767358
         * appid : HsjHxBMO
         * thirdAccCode : aliOrc
         */
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;
    }


    public CommonInterfaceBase getByKey(String key){
        Map<String, CommonInterfaceBase> map = this.commonInterfaceBaseList.stream()
                .collect(Collectors.toMap(CommonInterfaceBase::getKey, Function.identity(), (o, n) -> n));
        return map.get(key);
    }

    @Data
    public class  CommonInterfaceBase{
        private String status;
        private String url;
        private String apiCode;
        private String appid;
        private String thirdAccCode;
        private String key;
    }
}
